package com.sky.myapplication.designmode.simplefactory;

import com.sky.myapplication.designmode.Person;

/**
 * 简单设计模式
 */
public class SimpleFactory {

    public static Person makePerson(String name){
        if (name.equals("w")){
            Person person = new Person();
            person.setName("worker");
            return person;
        } else if (name.equals("s")) {
            Person person = new Person();
            person.setName("student");
            return person;
        } else {
            return null;
        }
    }
}
